Artificial intelligence tasks can be translated into machine learning optimization problems. Some simplified tasks, such as feed forward problems, can be carried out by classical processors. Other complicated tasks, such as those involving NP-hard problems, can be performed using quantum hardware, e.g., a quantum processor. Typically, a quantum processor is constructed and programmed to encode the solution to a corresponding machine optimization problem into an energy spectrum of a many-body quantum Hamiltonian characterizing the quantum hardware. For example, the solution is encoded in the ground state of the Hamiltonian. Through an annealing process in which the Hamiltonian evolves from an initial Hamiltonian into a problem Hamiltonian, the energy spectrum or the ground state of the Hamiltonian for solving the problem can be obtained without diagonalizing the Hamiltonian.